<h1><%=@h1_name%> - 逗死了</h1>
<% @posts.each do |post| %>
<div class="item">
  <div class="title"><a href="/detail/<%=post.id%>.html"><%=post.title%></a>
    &nbsp;<span class="pubdate"><%=post.postdate.in_time_zone(+8.hours).strftime('%m月%d日 %H:%M') %></span>
    &nbsp;<span class="tag">类别：<a rel="nofollow" href="/<%=Common.getCateUrlName post.cateid %>/"><%=Common.getCateName post.cateid%></a></span>
  </div>
  <% if(post.content != nil && post.content.size > 5) %>
  <div class="text"><%=raw(post.content)%></div>
  <% end %>
  <% if(post.pic != nil && post.pic.size > 5) %>
    <% (post.pic.split('|')).each do |pic| %><div class="pic"><img src="<%=thumbPic pic%>" border="0" /></div><% end %>
  <% end %>
  <% if(post.video != nil && post.video.size > 5) %>
    <% videoPic = thumbPic(Common.getVideoPic post.video); if(videoPic != nil) %><div class="video"><img src="<%=videoPic%>" url="<%=Common.getVideoUrl post.video%>" />
    <br/><a class="playlink" href="javascript:void(0);">点击播放视频</a>
  </div><% end %>
  <% end %>
</div>
<% end %>

<div id="side-pannel">
  <a href="#" title="返回顶部"><div class="top"></div></a>
  <a href="/feedback/" title="用户反馈"><div class="feedback"></div></a>
</div>
<div class='clearfix'></div> 
<div class='flickr_pagination'><%= will_paginate @posts, :renderer => 'PostLinkRenderer', :previous_label => '上页', :next_label => '下页', :url => request.url %></div>

<script type="text/javascript">
$().ready(function(){

  // 图片
  $('div.pic img').click(function(){ 
    var current = this.src;
    if(current.indexOf('/thumb/') > 1) {
      current = current.replace('/thumb/', '/medium/');
    } else {
      current = current.replace('/medium/', '/thumb/');
    }
    this.src = current;
  });

  // 视频
  $('div.video img').click(function(){
    var url = $(this).attr('url');
    var htm = '<embed src="'+ url +'" allowFullScreen="true" quality="high" width="480" height="400" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>';
    $(this).parents('div:first').html(htm);
  });

  // 播放
  $('div.video a.playlink').click(function(){
    var _div = $(this).parents('div:first');
    var _img = _div.find('img');
    if(_img.length > 0) _img.get(0).click();
  });
});
</script>